package com.heima.wemedia.fegin;

import com.heima.apis.wemedia.IWemediaClient;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmUser;
import com.heima.wemedia.service.WmChannelService;
import com.heima.wemedia.service.WmUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class WemediaClient implements IWemediaClient {
    @Autowired
    private WmUserService wmUserService;

    @Autowired
    private WmChannelService wmChannelService;

    @PostMapping("/api/v1/wemedia/save")
    @Override
    public ResponseResult creatCount(@RequestBody WmUser wmUser) {
        return wmUserService.CreatCount(wmUser);
    }

    @GetMapping("/api/v1/channels")
    @Override
    public ResponseResult getChannels() {
        return wmChannelService.findAll();
    }
}
